
 /* OVERVIEW OF DO FILE for creating Figure 1a
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

These analyses use the pink measure of working class and the Clausen measure of Social Welfare legislation
The Intro Clausen variable is coded 1 if a Legislator introduced a bill coded as social welfare legislation in a given congress. 

*/
 
clear

use "LegislatorDataPCS.dta"

*log using "BillIntro_Clausen.log", replace


replace median_hh=median_hh/1000


**109th Congresses
table member_wc_pink if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_pink)

gen T109 =member_wc_pink 
label variable T109 "109th Congress"

eststo cong109social:logit intro_clausen T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 

margins, dydx(T109) post
estimates store Cong109

estimate store cong109social

ren cem_matched cem_matched109
table cem_matched109

outreg2 using IntroAnalysis.xls, replace title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("109th Congress Social Welfare")


*110th Congresses
table member_wc_pink if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_pink)

gen T110 =member_wc_pink 
label variable T110 "110th Congress" 

eststo cong110social:logit intro_clausen T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110

margins, dydx(T110) post
estimates store Cong110

estimate store cong110social

ren cem_matched cem_matched110
table cem_matched110

outreg2 using IntroAnalysis.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("110th Congress Social Welfare ")


*111th Congresses
table member_wc_pink if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_pink)

gen T111 =member_wc_pink 
label variable T111 "111th Congress" 

eststo cong111social: logit intro_clausen T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111

estimate store cong111social

margins, dydx(T111) post
estimates store Cong111

ren cem_matched cem_matched111
table cem_matched111

outreg2 using IntroAnalysis.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("111th Congress Social Welfare ")



*112th Congresses
table member_wc_pink if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_pink)

gen T112 =member_wc_pink 
label variable T112 "112th Congress"

eststo cong112social:logit intro_clausen T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112

estimate store cong112social
margins, dydx(T112) post
estimates store Cong112

ren cem_matched cem_matched112
table cem_matched112

outreg2 using IntroAnalysis.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("112th Congress Social Welfare ")


**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_pink

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_pink)

gen Tall =member_wc_pink 
label variable Tall "All Congresses"

eststo AllCongSocial:logit intro_clausen Tall median_hh share_black party share_latino  dist_pct_union dem_vote_share i.cong [iweight=cem_weights] 

estimate store AllCongSocial
margins, dydx(Tall) post
estimates store CongAll

ren cem_matched cem_matchedALL
table cem_matchedALL

outreg2 using IntroAnalysis.xls, append title("Effect of Working-Class Legislator on Bill Introduction") ///
label ctitle("All Congresses Social Welfare ")

label variable T109 `""109th Congress" "2005-07""'
label variable T110 `""110th Congress" "2007-09""'
label variable T111 `""111th Congress" "2009-11""'
label variable T112 `""112th Congress" "2011-13""' 
label variable Tall `""All Congresses" "2007-13""' 


**Plot of Margins Result
	
	coefplot ///
    (Cong109, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong110, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong111, msymbol(O) mcolor(black) lcolor(black)) ///
    (Cong112, msymbol(O) mcolor(black) lcolor(black)) ///
    (CongAll, msymbol(O) mcolor(black) lcolor(black)) ///
    , ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	offset (0) ///
	 ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Probability of Introduction)

	graph save Figure1a.gph, replace

	*log close


*------------------------------------------------------------------------------------------------------------

 /* OVERVIEW OF DO FILE for creating Figure 1b
We have four congresses 109-112. We will do the matching separately for each Congress and then do a pooled analysis as well. 

These analyses use the Pink measure of working class and the Clausen measure of Social Welfare legislation
The DV is the total number of Clausen Social Welfare introudctions in a given Congressional session. 


*/

 
clear

use "LegislatorDataPCS.dta"

*log using "SumIntro.log", replace


replace median_hh=median_hh/1000


**109th Congresses
table member_wc_pink if cong==109

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==109, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party   if cong==109, tr(member_wc_pink)

gen T109 =member_wc_pink 
label variable T109 "109th Congress"

eststo cong109sum:reg sum_clausen_soc_welfare T109 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==109 , robust

estimate store cong109social

ren cem_matched cem_matched109
table cem_matched109

outreg2 using SumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("109th Congress Social Welfare")


*110th Congresses
table member_wc_pink if cong==110

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share  party if cong==110, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party  if cong==110, tr(member_wc_pink)

gen T110 =member_wc_pink 
label variable T110 "110th Congress"

eststo cong110social:reg sum_clausen_soc_welfare T110 median_hh share_black party share_latino party  dist_pct_union dem_vote_share [iweight=cem_weights] if cong==110, robust

estimate store cong110social

ren cem_matched cem_matched110
table cem_matched110

outreg2 using SumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("110th Congress Social Welfare")

*111th Congresses
table member_wc_pink if cong==111

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==111, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==111, tr(member_wc_pink)

gen T111 =member_wc_pink 
label variable T111 "111th Congress"

eststo cong111social: reg sum_clausen_soc_welfare T111 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==111, robust

estimate store cong111social

ren cem_matched cem_matched111
table cem_matched111


outreg2 using SumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("111th Congress Social Welfare")

*112th Congresses
table member_wc_pink if cong==112

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share party if cong==112, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share party if cong==112, tr(member_wc_pink)

gen T112 =member_wc_pink 
label variable T112 "112th Congress"

eststo cong112social:reg sum_clausen_soc_welfare T112 median_hh share_black party share_latino  dist_pct_union party dem_vote_share [iweight=cem_weights] if cong==112, robust

estimate store cong112social

ren cem_matched cem_matched112
table cem_matched112

outreg2 using SumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("112th Congress Social Welfare")

**All Congresses 
quietly tabulate cong, generate(new_congress)
table member_wc_pink

imb median_hh share_black share_latino  dist_pct_union votepct_updated dem_vote_share cong party, tr(member_wc_pink)

cem median_hh(#3) share_black party share_latino  dist_pct_union dem_vote_share cong party, tr(member_wc_pink)

gen Tall =member_wc_pink 
label variable Tall "All Congresses"

eststo AllCongSocial:reg sum_clausen_soc_welfare Tall median_hh share_black party share_latino  dist_pct_union party dem_vote_share i.cong [iweight=cem_weights] , robust

estimate store AllCongSocial

ren cem_matched cem_matchedALL
table cem_matchedALL

outreg2 using SumIntros.xls, replace title("Effect of Working-Class Legislator on Number Bill Introductions") ///
label ctitle("All Congresses Social Welfare")


coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong110social, label("110") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong111social, label("111") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black) lcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) lcolor(black)), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	ylabel(none) ///
	offset (0) ///
	ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Number of Bills)

graph save Figure1b.gph, replace
	
/*	This version has the labels with the Congresses
coefplot ///
    (cong109social,  label("109") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong110social, label("110") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong111social, label("111") msymbol(O) mcolor(black) lcolor(black)) ///
    (cong112social, label("112") msymbol(O) mcolor(black) lcolor(black)) ///
    (AllCongSocial, label("All") msymbol(O) mcolor(black) lcolor(black)), ///
    keep (T109 T110 T111 T112 Tall) ///
    scheme(s1mono) ///
    xline(0) ///
    level(90) ///
    legend(off) ///
	 ciopts(recast(rcap) lcolor(black)) ///
    xtitle(Number of Bills)
	
*/

*log close

*-----------------------------------------------------------------
**Creating Figure 1

*Navigate to folder that contains both Figure 1a.gph and Figure 1b. gph

graph combine ///
Figure1a.gph ///
Figure1b.gph , ///
cols(2) /// 
note (90% Confidence Intervals)





